package jiakuang2;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
public class learn {
    public static void main(String[] args) {
        //创建集合
        Set<Integer> set1=new HashSet<Integer>();
        for(int j=0;j<=10;j++){
        int num=j;
        //存储数据
        set1.add(num);
    }
        int sum = 0;
        int count=0;
        //构造器定义
        Iterator<Integer> te=set1.iterator();
        //遍历
        while(te.hasNext()){
            //获取值
           sum+= te.next();
            count=sum/ set1.size();
        }
        //增强遍历
        //for(int te:set1 ){
           //sum += te;
            //count=sum/ set1.size();
        //}
        System.out.println("和为:" + sum);
        System.out.println("平均分:"+count);
}
}
